<?php 
$v_type_spec_work = "";
if(isset($_REQUEST["hdn_spec_worktype"]))
{
	$v_type_spec_work = $_REQUEST["hdn_spec_worktype"];
}

$v_record_id_list = "";
if(isset($_REQUEST["hdn_record_id_list"]))
{
	$v_record_id_list = $_REQUEST["hdn_record_id_list"];
}
$v_work_date = date("d/m/Y");		// ngay thuc hien
/*// Kiem tra xem nguoi dang nhap hien thoi co quyen cap nhat hay khong?
// kiem tra lai quyen cua nguoi dang nhap thuc hien chuc nang nay??????????????
if(!_check_permission_on_function($_SESSION['staff_id'], $_ISA_APP_CODE, _CONST_ONEGATE_WORKTYPE_UPDATE)){?>
	<script>
		alert("<? echo _CONST_FUNCTION_PERMISSION_ERROR; ?>");
		if (_MODAL_DIALOG_MODE==1){
			window.location = "<? echo $v_url; ?>";
		}else{
			window.history.back();
		}	
	</script><?
}*/
$arr_record_id = explode(",",$v_record_id_list);
if(_is_sqlserver()){
	// lay ham tuong ung clone_time hay release_time
	for($j = 0 ; $j < sizeof($arr_record_id); $j++)
	{
		$sql = create_sql_string_for_update_record_work($v_type_spec_work, $arr_record_id[$j], $v_staff_id, $v_work_date);
		$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
		$rs = $ado_conn->GetRow($sql); 
		$v_error = _replace_bad_char(trim($rs['RET_ERROR']));		
	}
}

if (!is_null($v_error) and $v_error<>""){?>
	<script>
		alert("<?php echo $v_error; ?>");
		if (_MODAL_DIALOG_MODE==1){
			window.location = "<?php echo $v_url; ?>";
		}else{
			window.history.back();
		}	
	</script><?php
	exit;
}
sleep(0);
?>
<form action="index.php" method="post" name="f_back">
	<input type="hidden" name="fuseaction" value="DISPLAY_ALL_RECORD_SPEC_WORK">
	<input type="hidden" name="hdn_item_id" value="<?php echo $v_old_worktype_id;?>">
	<input type="hidden" name="hdn_spec_worktype" value="<?=$v_type_spec_work?>">
	<input type="hidden" name="hdn_filter" value="<?php echo $v_filter; ?>">
</form>
<Script language="javascript">
//	return_value = "<?php echo $v_worktype_id; ?>" + _LIST_DELIMITOR + "<?php echo $v_filter; ?>"  
//	goto_after_update_data(0, "DISPLAY_SINGLE_WORKTYPE_SPEC",return_value);
	document.forms(0).submit();
</Script>
